import React           			from 'react';
import { Link } 				from 'react-router-dom';
import {inject, observer }      from 'mobx-react'
import {Pagination } from 'antd';

import Top						from 'page/top/index.jsx';
import Todo						from 'page/todo/index.jsx';

import Service from 'service/index.jsx';
const _service = new Service();


@inject('store')
@observer
class Home extends React.Component{
	// 构造函数
	constructor(props){
		super(props);
	}
	componentDidMount(){
		if(this.props.store.firstLoading){
			this.props.store.getThing();
			this.props.store.changeFirstLoading();
		}else{
			console.log("不需要第一次加载");
		}
	}
	render(){
		const style = {textAlign:'center'};
		return(
				<div>
					<Top/>
					<div className="page-wrapper">
						<Todo />
						<Pagination showQuickJumper className="pagination" 
						defaultCurrent={1}
		    			current={this.props.store.pageNum} 
		    			total={this.props.store.total_tips} 
		    			pageSize={this.props.store.pageSize}
		    			onChange={(page, pageSize) => {
		    				this.props.store.setPageInfo(page, pageSize);
		    				this.props.store.getThing();
		    			}} />
					</div>
				</div>
		);
	}
}

export default Home;
